<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="./vue.global.js"></script>
  <title>Document</title>
  <style>
    html, body {
      width: 100%;
      height: 100%;
    }
    .modal {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: rgba(0, 0, 0, 0.5);
    }
  </style>
</head>
<body>
  <div id="root">
    <div style="position: relative;">
      <h3>Tooltips with Vue 3 Teleport</h3>
      <div>
        <modal-button></modal-button>
      </div>
    </div>
  </div>
  <script>
    const { createApp, computed, provide, ref, inject, onMounted } = window.Vue

    const ModalButton = {
      template: `
        <button @click="modalOpen = true">
            Open full screen modal!
        </button>

        <teleport to="body">
          <div v-if="modalOpen" class="modal">
            <div>
              I'm a modal! 
              <button @click="modalOpen = false">
                Close
              </button>
            </div>
          </div>
        </telport>
      `,
      data() {
        return { 
          modalOpen: false
        }
      }
    }

    const app = createApp({
      components: {
        ModalButton
      },


      setup(props) {
        
      }
    })

    let vm = app.mount('#root')
  </script>
</body>
</html>